home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / tos / futils / futils~1 / man / manpages.zoo / compress.1 < prev    next >
Encoding:
Text File  |  1991-11-11  |  6.8 KB  |  199 lines

  1.  
  2.  
  3.  
  4. COMPRESS(1)                   local                   COMPRESS(1)
  5.  
  6.  
  7.  
  8. NAME
  9.      compress, uncompress, zcat  -  compress and uncompress files
  10.  
  11. SYNOPSIS
  12.      compress [ -c ] [ -C ] [ -d ] [ -f ] [ -v ] [ -b _✓b_✓i_✓t_✓s ] [ _✓f_✓i_✓l_✓e_✓n_✓a_✓m_✓e
  13.      ... ]
  14.      uncompress [ -c ] [ -f ] [ -v ] [ -V ] [ _✓f_✓i_✓l_✓e_✓n_✓a_✓m_✓e ... ]
  15.      zcat [ _✓f_✓i_✓l_✓e_✓n_✓a_✓m_✓e ... ]
  16.  
  17. DESCRIPTION
  18.      Compresses the specified files or standard input.  Each file
  19.      is replaced by a file with the extension .Z, but only if the
  20.      file got smaller.  If no files are specified, the compres-
  21.      sion is applied to the standard input and is written to
  22.      standard output regardless of the results.  Compressed files
  23.      can be restored to their original form by specifying the -d
  24.      option, or by running _✓u_✓n_✓c_✓o_✓m_✓p_✓r_✓e_✓s_✓s (linked to _✓c_✓o_✓m_✓p_✓r_✓e_✓s_✓s), on
  25.      the .Z files or the standard input.
  26.  
  27.      If the output file exists, it will not be overwritten unless
  28.      the -f flag is given.  If -f is not specified and _✓c_✓o_✓m_✓p_✓r_✓e_✓s_✓s
  29.      is run in the foreground, the user is prompted as to whether
  30.      the file should be overwritten.
  31.  
  32.      If the -f flag is given, all files specified are replaced
  33.      with .Z files - even if the file didn't get smaller.
  34.  
  35.      When file names are given, the ownership (if run by root),
  36.      modes, accessed and modified times are maintained between
  37.      the file and its .Z version.  In this respect, _✓c_✓o_✓m_✓p_✓r_✓e_✓s_✓s can
  38.      be used for archival purposes, yet can still be used with
  39.      _✓m_✓a_✓k_✓e(1) after uncompression.
  40.  
  41.      The -c option causes the results of the compress/uncompress
  42.      operation to be written to stdout; no files are changed.
  43.      The _✓z_✓c_✓a_✓t program is the same as specifying -c to _✓u_✓n_✓c_✓o_✓m_✓p_✓r_✓e_✓s_✓s
  44.      (all files are unpacked and written to stdout).
  45.  
  46.      _✓C_✓o_✓m_✓p_✓r_✓e_✓s_✓s uses the modified Lempel-Ziv algorithm described in
  47.      "A Technique for High Performance Data Compression", Terry
  48.      A. Welch, _✓I_✓E_✓E_✓E _✓C_✓o_✓m_✓p_✓u_✓t_✓e_✓r Vol 17, No 6 (June 1984), pp 8-19.
  49.      Common substrings in the file are first replaced by 9-bit
  50.      codes 257 and up.  When code 512 is reached, the algorithm
  51.      switches to 10-bit codes and continues to use more bits
  52.      until the _✓b_✓i_✓t_✓s limit as specified by the -b flag is reached
  53.      (default 16).  _✓B_✓i_✓t_✓s must be between 9 and 16.  The default
  54.      can be changed in the source to allow _✓c_✓o_✓m_✓p_✓r_✓e_✓s_✓s to be run on
  55.      a smaller machine.
  56.  
  57.      After the _✓b_✓i_✓t_✓s limit is reached, _✓c_✓o_✓m_✓p_✓r_✓e_✓s_✓s periodically
  58.      checks the compression ratio.  If it is increasing, _✓c_✓o_✓m_✓p_✓r_✓e_✓s_✓s
  59.      continues to use the codes that were previously found in the
  60.  
  61.  
  62.  
  63. Page 1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. COMPRESS(1)                   local                   COMPRESS(1)
  71.  
  72.  
  73.  
  74.      file.  However, if the compression ratio decreases, _✓c_✓o_✓m_✓p_✓r_✓e_✓s_✓s
  75.      discards the table of substrings and rebuilds it from
  76.      scratch.  This allows the algorithm to adapt to the next
  77.      "block" of the file.  The -C (compatibility) flag prevents
  78.      subdivision of the file into blocks; this produces an output
  79.      file that old versions of _✓c_✓o_✓m_✓p_✓r_✓e_✓s_✓s can read.
  80.  
  81.      A two byte magic number is prepended to the file to ensure
  82.      that neither uncompression of random text nor recompression
  83.      of compressed text are attempted.  In addition, the _✓b_✓i_✓t_✓s
  84.      specified during _✓c_✓o_✓m_✓p_✓r_✓e_✓s_✓s is written to the file so that the
  85.      -b flag can be omitted for _✓u_✓n_✓c_✓o_✓m_✓p_✓r_✓e_✓s_✓s.
  86.  
  87.      The amount of compression obtained depends on the size of
  88.      the input file, the amount of _✓b_✓i_✓t_✓s per code, and the distri-
  89.      bution of character substrings.  Typically, text files, such
  90.      as C programs, are reduced by 50-60%.  Compression is gen-
  91.      erally much better than that achieved by Huffman coding (as
  92.      used in _✓p_✓a_✓c_✓k), or adaptive Huffman coding (_✓c_✓o_✓m_✓p_✓a_✓c_✓t), and
  93.      takes less time to compute.
  94.  
  95.      If the -v (verbose) flag is given, then after each file is
  96.      compressed, a message is printed giving the percentage of
  97.      the input file that has been saved by compression.
  98.  
  99.      If the -V (version) flag is given, the program's version
  100.      number is printed.
  101.  
  102.      The exit status is normally 0; if the last file gets bigger
  103.      after compression, the exit status is 2; if an error occurs,
  104.      the exit status is 1.
  105.  
  106. SEE ALSO
  107.      compact(1), pack(1)
  108.  
  109. DIAGNOSTICS
  110.      Usage: compress [-cCdfvV] [-b maxbits] [file ...]
  111.              Invalid options were specified on the command line.
  112.      Missing maxbits
  113.              Maxbits must follow -b.
  114.      Unknown flag: '_✓x';
  115.              Invalid flags were specified on the command line.
  116.      _✓f_✓i_✓l_✓e:  not in compressed format
  117.              The specified file has not been compressed.
  118.      _✓f_✓i_✓l_✓e:  compressed with _✓x_✓x bits, can only handle _✓y_✓y bits
  119.              The specified file was compressed by a compress pro-
  120.              gram that could handle more _✓b_✓i_✓t_✓s than the current
  121.              compress program.  Recompress the file with a
  122.              smaller _✓b_✓i_✓t_✓s.
  123.      _✓f_✓i_✓l_✓e:  already has .Z suffix -- no change
  124.              Cannot compress a file that has a ".Z" suffix.
  125.              _✓m_✓v(1) the file to a different name and try again.
  126.  
  127.  
  128.  
  129. Page 2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. COMPRESS(1)                   local                   COMPRESS(1)
  137.  
  138.  
  139.  
  140.      _✓f_✓i_✓l_✓e:  filename too long to tack on .Z
  141.              The specified file cannot be compressed because its
  142.              filename is longer than 12 characters.  _✓m_✓v(1) the
  143.              file to a different name and try again.  This mes-
  144.              sage does not occur on 4.2BSD systems.
  145.      _✓f_✓i_✓l_✓e already exists; do you wish to overwrite (y or n)?
  146.              Respond "y" if you want the output file to be
  147.              replaced; "n" if you want it to be left alone.
  148.      _✓f_✓i_✓l_✓e:
  149.              This message fragment is written during the process-
  150.              ing of a file.
  151.      Compression: _✓x_✓x._✓x_✓x%
  152.              This message fragment gives the percentage of the
  153.              input file that has been saved by compression.
  154.      -- not a regular file: unchanged
  155.              This message fragment is written when the input file
  156.              is not a regular file.  The input file is left
  157.              unchanged.
  158.      -- has _✓x_✓x other links: unchanged
  159.              This message fragment is written when the input file
  160.              has links.  The input file is left unchanged.  See
  161.              _✓l_✓n(1) for more information.
  162.      -- file unchanged
  163.              This message fragment is written when no savings are
  164.              achieved by compression.  The input file is left
  165.              unchanged.
  166.      -- replaced with _✓f_✓i_✓l_✓e
  167.              This message fragment is written when a file has
  168.              been sucessfully compressed/uncompressed.
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195. Page 3
  196.  
  197.  
  198.  
  199.